﻿/*
 * Copyright (c) Huawei Technologies Co., Ltd. 2020-2020. All rights reserved.
 * Description: 4K 以及特有功能
 * Author: 辛爱国 x30005137
 * Create: 2020-08-18
 * Notes: 无
 */
#pragma once

#include <qdialog.h>
#include <QResizeEvent>
#include <QMouseEvent>
#include <QEvent>
#include <qwidget.h>
struct CommenMethod {
    bool m_UseCenter = false;
    double m_rate { 0.0 };
    double getCurrentRate(QWidget *wid);
    QWidget *findFinalParent(QWidget *wid);
};

class HWDialog : public QDialog, public CommenMethod {
    Q_OBJECT

public:
    HWDialog(QWidget *parent);
    ~HWDialog();
    virtual void mousePressEvent(QMouseEvent *event);
    virtual void mouseMoveEvent(QMouseEvent *event);
    virtual void mouseReleaseEvent(QMouseEvent *event);
    virtual void resizeEvent(QResizeEvent *event);
    virtual void saveChildrenInfo();
    virtual bool event(QEvent *event);
public slots:
    virtual void resizeWindow();
protected:
    bool m_isMoveWindow { false };               // 是否移动窗口
    QPoint m_mouseStartPoint { 0, 0 };           // 窗口移动起始点
    QPoint m_windowTopLeftPoint { 0, 0 };        // 窗口的左上角

    void saveSingelWidget(QWidget *wid);
    void scalWidgets(QWidget *wid);
    void scalPushButton(QWidget *wid);
    void scalCheckBox(QWidget *wid);
    void scalSlider(QWidget *wid);
    void scalLabel(QWidget *wid);
    void scalCombox(QWidget *wid);
};
